
package main

import (
	"fmt"
)

// 这种算法效率有点低
func rotato(s []int, inx int) {
	if (inx >= 1 || inx < len(s)) {
		l := len(s)
		t := inx
		for inx > 0 {
			x := s[inx-1]
			m := l-t+inx
			copy(s[inx-1:], s[inx:m])
			s[m-1] = x;
			inx--
		}
	}
}

func main() {
	a := []int{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}
	fmt.Println(a)
	rotato(a, 5)
	fmt.Println(a)

}